package com.ias.agdis_r.activity.setting;

import com.ias.agdis_r.R;
import com.ias.agdis_r.activity.BaseKeyActivity;
import com.ias.agdis_r.activity.MainActivity;
import com.ias.agdis_r.util.S;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 版本信息
 * 
 * @author qibo.yu
 *
 */
public class AppInfoActivity extends BaseKeyActivity {

	private TextView title;

	@SuppressWarnings("unused")
	private TextView appVersion;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_app_info);

		initactionBar();
		setTitle(R.string.AppInfoActivity);

		appVersion = (TextView) findViewById(R.id.info_app_version);

		appVersion.setText(S.getAppVersion());

	}

	@Override
	public void setTitle(CharSequence title) {
		this.title.setText(title);
		super.setTitle(title);
	}

	@Override
	public void setTitle(int titleId) {
		this.setTitle(getString(titleId));
	}

	@SuppressLint("InflateParams")
	private void initactionBar() {
		final Activity context = this;

		ActionBar actionBar = getActionBar();

		actionBar.setCustomView(LayoutInflater.from(this).inflate(R.layout.actionbar_settings, null));
		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
		actionBar.setDisplayShowCustomEnabled(true);

		this.title = (TextView) findViewById(R.id.txt_title);

		ImageView back = (ImageView) findViewById(R.id.actionbar_settings_back);
		back.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				finish();
			}
		});
	}

}
